<template>
	<view class="page">
		<!-- 启动方式分为属性的isShow和ref，接下来是isShow启动的示例 -->
		<view>
			<view class="desc">isShow</view>
			<button class="button" @tap="btnClick">点击选择</button>
		</view>
		<ch-region-select @cancle="cancelHandle" @confirm="confirmHandle"></ch-region-select>

		<!-- 启动方式分为属性的isShow和ref，接下来是ref启动的示例 -->
		<view>
			<view class="desc">ref</view>
			<button class="button" @tap="btnClick1">点击选择</button>
		</view>
		<ch-region-select ref="myRSelect" @confirm="confirmHandle"></ch-region-select>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		onLoad() {},
		onUnload() {},
		methods: {
			btnClick(index) {
				this.curIndex = index
				this.items[index].pShowFlag = true
			},
			btnClick1() {
				this.$refs.myRSelect.show()
			},
			cancelHandle(data) {
				this.items[this.curIndex].pShowFlag = false
			},
			confirmHandle(data) {
				this.items[this.curIndex].pShowFlag = false
				this.items[this.curIndex].pValue = data.value
			},
		}
	}
</script>
<style>
	.page {
		padding: 20rpx;
	}

	.desc {
		margin-top: 30rpx;
		margin-bottom: 10rpx;
		color: #ff0000;
		font-size: 12px;
		white-space: pre-line;
	}

	.button {
		margin-bottom: 20rpx;
	}

	.flex-between {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
</style>
